У нас есть еще один формат вызова DrawImage:
public void DrawImage(Image image,Point[] destPoints);
В данном случае изображение будет вписано в рамки ограниченные массивом точек. И искажено. Смотрим пример.
using System;
using System.Windows.Forms;
using System.Collections;
using System.Drawing;
class MainForm : Form
{
public MainForm()
{
Text = "This is my form";
myArray = new ArrayList();
myArray.Add(Image.FromFile("D:\\net_step\\1\\Watch.jpg"));
}
protected override void OnPaint(PaintEventArgs pe)
{
Graphics g = pe.Graphics;
Point p1=new Point(1,1);
Point p2=new Point(100,20);
Point p3=new Point(100,50);
Point[] p={p1,p2,p3};
foreach (Image i in myArray)
{
g.DrawImage(i,p);
}
}
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button==MouseButtons.Left)
{
x=x+50;
}
else
{
if (x>0) x=x-50;
}
this.Invalidate();
}
public static void Main(string[] args)
{
Application.Run(new MainForm());
}
static int x;
ArrayList myArray;
}
Вот так оно теперь выглядит.
